var maxProfit = function (prices) {
    let maxPro = 0
    let min = prices[0]
    for (let i = 0; i < prices.length; i++) {
        if (prices[i] < min) {
            min = prices[i]
        } else if (prices[i] - min > maxPro) {
            maxPro = prices[i] - min
        }
    }
    return maxPro
};